package com.cxl.price.bean;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

import com.summer.core.common.BeanName;
import com.summer.core.entity.BaseBean;

@Entity
@BeanName("tb商品")
public class Goods  extends BaseBean{
	
	
	private static final long serialVersionUID = -5613836731395308910L;
	//名称
	private String name;
	
	private Double price;
	
	private Double new_price;

    //tb地址
	private String tb_url;
	//tb描述
	private String description;
	//商品地址
//	private String shop_url;
	//关键字
	private String search_key;
	
	private String tb_img;
	
	private String pinpai;
	
	private String xinghao;
	
	private Long num; //商品数量
	
	private Long num_iid;//淘宝数字编号
	
	private Long product_id;//淘宝产品ID
	
	private String onSale; //上下架   onsale上架   0下架
	
	private Long volume; //30天交易量
	
	private String propsName;//属性中文名
	
	private boolean hasShowcase;//是否橱窗推荐
	
	
	private boolean isSynch; //是否同步 是否做了修改没提交的
	
	private boolean matchGood; //是否已经匹配完成   匹配完成的  下次匹配时 不在匹配
	
	private String seller_cids; //卖家的目录
	
	//private Good mainGood; //主要关联的
	
	private Set<Good> good;
	
	private Set<OtherShopPrice> otherShopPriceSet;
	
	private Set<Imgs> imgsSet;
	
//	//对方维护 good是在另一个表的
//	@ManyToMany(mappedBy="goods")

	@OneToMany(cascade=CascadeType.ALL,mappedBy="goods",fetch=FetchType.LAZY)		
	public Set<Good> getGood() {
		return good;
	}
	public void setGood(Set<Good> good) {
		this.good = good;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
		
	}
	
	public String getTb_url() {
		return tb_url;
	}
	public void setTb_url(String tbUrl) {
		tb_url = tbUrl;
	}
	@Column(length=25000)
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
//	public String getShop_url() {
//		return shop_url;
//	}
//	public void setShop_url(String shopUrl) {
//		shop_url = shopUrl;
//	}
	public String getSearch_key() {
		return search_key;
	}
	public void setSearch_key(String searchKey) {
		search_key = searchKey;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public Double getPrice() {
		return price;
	}
	
	public Double getNew_price() {
		return new_price;
	}
	public void setNew_price(Double newPrice) {
		new_price = newPrice;
	}
	public String getTb_img() {
		return tb_img;
	}
	public void setTb_img(String tbImg) {
		tb_img = tbImg;
	}
	public String getPinpai() {
		return pinpai;
	}
	public void setPinpai(String pinpai) {
		this.pinpai = pinpai;
	}
	public String getXinghao() {
		return xinghao;
	}
	public void setXinghao(String xinghao) {
		this.xinghao = xinghao;
	}
	public Long getNum_iid() {
		return num_iid;
	}
	public void setNum_iid(Long numIid) {
		num_iid = numIid;
	}
	public String getOnSale() {
		return onSale;
	}
	public void setOnSale(String onSale) {
		this.onSale = onSale;
	}
	public Long getNum() {
		return num;
	}
	public void setNum(Long num) {
		this.num = num;
	}
	public boolean isSynch() {
		return isSynch;
	}
	public void setSynch(boolean isSynch) {
		this.isSynch = isSynch;
	}
	
	public void setImgsSet(Set<Imgs> imgsSet) {
		this.imgsSet = imgsSet;
	}
	
	public boolean isMatchGood() {
		return matchGood;
	}
	public void setMatchGood(boolean matchGood) {
		this.matchGood = matchGood;
	}
	public Long getVolume() {
		return volume;
	}
	public void setVolume(Long volume) {
		this.volume = volume;
	}
	
	
	  public void addGood(Good good)
	    {
	        if(!this.getGood().contains(good))
	        {
	            this.getGood().add(good);
	        }
	    }
	    
	    public void removeGood(Good good)
	    {
	    	 if(this.getGood().contains(good))
	        {
	    		 this.getGood().remove(good);
	        }
	    }
	   
	    @OneToMany(cascade=CascadeType.ALL,mappedBy="goods",fetch=FetchType.LAZY)	
		public Set<Imgs> getImgsSet() {
	    	if(imgsSet==null)
	    		imgsSet=new HashSet<Imgs>();
			return imgsSet;
		}
	    
	    
		
	    
	    public void addImgs(Imgs imgs)
	    {
	        if(!this.getImgsSet().contains(imgs))
	        {
	            this.getImgsSet().add(imgs);
	        }
	    }
	    
	    public void removeImgs(Imgs imgs)
	    {
	    	if(this.getImgsSet().contains(imgs))
		     {
		            this.getImgsSet().remove(imgs);
		     }
	    }
		public String getSeller_cids() {
			return seller_cids;
		}
		public void setSeller_cids(String sellerCids) {
			seller_cids = sellerCids;
		}
		
		public Long getProduct_id() {
			return product_id;
		}
		public void setProduct_id(Long productId) {
			product_id = productId;
		}
		
		@Column(length=1000)
		public String getPropsName() {
			return propsName;
		}
		public void setPropsName(String propsName) {
			this.propsName = propsName;
		}
		
		
		@OneToMany(cascade=CascadeType.ALL,mappedBy="goods",fetch=FetchType.LAZY)	
		public Set<OtherShopPrice> getOtherShopPriceSet() {
			return otherShopPriceSet;
		}
		
		public void setOtherShopPriceSet(Set<OtherShopPrice> otherShopPriceSet) {
			this.otherShopPriceSet = otherShopPriceSet;
		}
		public boolean isHasShowcase() {
			return hasShowcase;
		}
		public void setHasShowcase(boolean hasShowcase) {
			this.hasShowcase = hasShowcase;
		}
	    
		
		
	
	
	

}
